/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Admin
 */
@Entity
@Table(name = "USERS")
@NamedQueries({
    @NamedQuery(name = "Users.findAll", query = "SELECT u FROM Users u"),
    @NamedQuery(name = "Users.findByUName", query = "SELECT u FROM Users u WHERE u.uName = :uName"),
    @NamedQuery(name = "Users.findByUPass", query = "SELECT u FROM Users u WHERE u.uPass = :uPass"),
    @NamedQuery(name = "Users.findByUEmail", query = "SELECT u FROM Users u WHERE u.uEmail = :uEmail")})
public class Users implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "U_NAME")
    private String uName;
    @Basic(optional = false)
    @Column(name = "U_PASS")
    private String uPass;
    @Column(name = "U_EMAIL")
    private String uEmail;
    @OneToMany(mappedBy = "uName")
    private List<Accounts> accountsList;
    @OneToMany(mappedBy = "uName")
    private List<Podania> podaniaList;

    public Users() {
    }

    public Users(String uName) {
        this.uName = uName;
    }

    public Users(String uName, String uPass) {
        this.uName = uName;
        this.uPass = uPass;
    }
        public Users(String uName, String uPass, String uEmail) {
        this.uName = uName;
        this.uPass = uPass;
        this.uEmail= uEmail;
    }

    public String getUName() {
        return uName;
    }

    public void setUName(String uName) {
        this.uName = uName;
    }

    public String getUPass() {
        return uPass;
    }

    public void setUPass(String uPass) {
        this.uPass = uPass;
    }

    public String getUEmail() {
        return uEmail;
    }

    public void setUEmail(String uEmail) {
        this.uEmail = uEmail;
    }

    public List<Accounts> getAccountsList() {
        return accountsList;
    }

    public void setAccountsList(List<Accounts> accountsList) {
        this.accountsList = accountsList;
    }

    public List<Podania> getPodaniaList() {
        return podaniaList;
    }

    public void setPodaniaList(List<Podania> podaniaList) {
        this.podaniaList = podaniaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (uName != null ? uName.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Users)) {
            return false;
        }
        Users other = (Users) object;
        if ((this.uName == null && other.uName != null) || (this.uName != null && !this.uName.equals(other.uName))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Users[uName=" + uName + "]";
    }

}
